Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

feat: Assistants API #139

Closed
wants to merge 1 commit into from
Closed

Conversation

cdillard
Copy link

@cdillard cdillard commented Dec 16, 2023

  • feat: Assistants API

What

Eight new API endpoints are exposed in the APIPath to support the assistants API.

    static let assistants = "/v1/assistants"
    static let assistantsModify = "/v1/assistants/ASST_ID"
    static let threads = "/v1/threads"
    static let runs = "/v1/threads/THREAD_ID/runs"
    static let runRetrieve = "/v1/threads/THREAD_ID/runs/RUN_ID"
    static let runRetrieveSteps = "/v1/threads/THREAD_ID/runs/RUN_ID/steps"
    static let threadsMessages = "/v1/threads/THREAD_ID/messages"
    static let files = "/v1/files"

The OpenAIProtocol is modified as follows: added

    func assistants(query: AssistantsQuery?, method: String, completion: @escaping (Result<AssistantsResult, Error>) -> Void)    

    func threads(query: ThreadsQuery, completion: @escaping (Result<ThreadsResult, Error>) -> Void)

    func runs(threadId: String, query: RunsQuery, completion: @escaping (Result<RunsResult, Error>) -> Void)

    func runRetrieve(threadId: String, runId:String, completion: @escaping (Result<RunRetreiveResult, Error>) -> Void)

    func runRetrieveSteps(threadId: String, runId: String, before: String?, completion: @escaping (Result<RunRetreiveStepsResult, Error>) -> Void)

    func threadsMessages(threadId: String, before: String?, completion: @escaping (Result<ThreadsMessagesResult, Error>) -> Void)

    func threadsAddMessage(threadId: String, query: ThreadAddMessageQuery, completion: @escaping (Result<ThreadAddMessageResult, Error>) -> Void)

    func files(query: FilesQuery, completion: @escaping (Result<FilesResult, Error>) -> Void)

Example App:

A new demonstration of the assistants API and its requirements of the polling has been added to the Demo app.

  • Now you can create a new assistant on the Chats tab by selecting "+" -> New Assistant -> Fill in details -> OK.
    This should result in a "New Assistant" row being added to the chats, you can chat with your newly created assistant in this conversation.

  • You can now list your OpenAI API Assistants on the "Assistants" tab. Select "+" -> Get Assistants to load the assistants list.

  • For now I've implemented additional chat messages that are shown when run steps include tool calls such as code interpreter or retrieval.

Why

To support the assistant features like threads, runs, tools (such as code_interpreter and retrieval), and files with assistants API.

Affected Areas

OpenAI

* feat: Assistants API

* Rem accidentally committed Dev team

* Demoapp syntax fix for ImageCreationView

* assistant paging, modify, fix

* demo: enhancement: Handle local message replacement, README update

* clean, runRetrieveSteps implemented, SupportedFileTypes implemented

* Handle run retrieve steps

* Assistant README, add run retrieve steps

* display run retrieve steps in updating fashion for code_interpreter
Copy link

sonarcloud bot commented Dec 16, 2023

Quality Gate Passed Quality Gate passed

The SonarCloud Quality Gate passed, but some issues were introduced.

56 New issues
0 Security Hotspots
No data about Coverage
2.2% Duplication on New Code

See analysis details on SonarCloud

@cdillard cdillard closed this Dec 17, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

1 participant